package edu.hcmiu.portal.model.impl;

import com.liferay.portal.kernel.bean.ReadOnlyBeanHandler;
import com.liferay.portal.kernel.util.GetterUtil;
import com.liferay.portal.kernel.util.HtmlUtil;
import com.liferay.portal.model.impl.BaseModelImpl;

import com.liferay.portlet.expando.model.ExpandoBridge;
import com.liferay.portlet.expando.model.impl.ExpandoBridgeImpl;

import edu.hcmiu.portal.model.hook_user;
import edu.hcmiu.portal.model.hook_userSoap;

import java.io.Serializable;

import java.lang.reflect.Proxy;

import java.sql.Types;

import java.util.ArrayList;
import java.util.List;


/**
 * <a href="hook_userModelImpl.java.html"><b><i>View Source</i></b></a>
 *
 * <p>
 * ServiceBuilder generated this class. Modifications in this class will be
 * overwritten the next time is generated.
 * </p>
 *
 * <p>
 * This class is a model that represents the <code>hook_user</code> table
 * in the database.
 * </p>
 *
 * @author Brian Wing Shun Chan
 *
 * @see edu.hcmiu.portal.model.hook_user
 * @see edu.hcmiu.portal.model.hook_userModel
 * @see edu.hcmiu.portal.model.impl.hook_userImpl
 *
 */
public class hook_userModelImpl extends BaseModelImpl<hook_user> {
    public static final String TABLE_NAME = "hook_user";
    public static final Object[][] TABLE_COLUMNS = {
            { "userID", new Integer(Types.BIGINT) },
            

            { "userName", new Integer(Types.VARCHAR) },
            

            { "userEmail", new Integer(Types.VARCHAR) }
        };
    public static final String TABLE_SQL_CREATE = "create table hook_user (userID LONG not null primary key,userName VARCHAR(75) null,userEmail VARCHAR(75) null)";
    public static final String TABLE_SQL_DROP = "drop table hook_user";
    public static final String DATA_SOURCE = "liferayDataSource";
    public static final String SESSION_FACTORY = "liferaySessionFactory";
    public static final String TX_MANAGER = "liferayTransactionManager";
    public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.util.service.ServiceProps.get(
                "value.object.entity.cache.enabled.edu.hcmiu.portal.model.hook_user"),
            true);
    public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.util.service.ServiceProps.get(
                "value.object.finder.cache.enabled.edu.hcmiu.portal.model.hook_user"),
            true);
    public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.util.service.ServiceProps.get(
                "lock.expiration.time.edu.hcmiu.portal.model.hook_user"));
    private long _userID;
    private String _userName;
    private String _userEmail;
    private transient ExpandoBridge _expandoBridge;

    public hook_userModelImpl() {
    }

    public static hook_user toModel(hook_userSoap soapModel) {
        hook_user model = new hook_userImpl();

        model.setUserID(soapModel.getUserID());
        model.setUserName(soapModel.getUserName());
        model.setUserEmail(soapModel.getUserEmail());

        return model;
    }

    public static List<hook_user> toModels(hook_userSoap[] soapModels) {
        List<hook_user> models = new ArrayList<hook_user>(soapModels.length);

        for (hook_userSoap soapModel : soapModels) {
            models.add(toModel(soapModel));
        }

        return models;
    }

    public long getPrimaryKey() {
        return _userID;
    }

    public void setPrimaryKey(long pk) {
        setUserID(pk);
    }

    public Serializable getPrimaryKeyObj() {
        return new Long(_userID);
    }

    public long getUserID() {
        return _userID;
    }

    public void setUserID(long userID) {
        _userID = userID;
    }

    public String getUserName() {
        return GetterUtil.getString(_userName);
    }

    public void setUserName(String userName) {
        _userName = userName;
    }

    public String getUserEmail() {
        return GetterUtil.getString(_userEmail);
    }

    public void setUserEmail(String userEmail) {
        _userEmail = userEmail;
    }

    public hook_user toEscapedModel() {
        if (isEscapedModel()) {
            return (hook_user) this;
        } else {
            hook_user model = new hook_userImpl();

            model.setNew(isNew());
            model.setEscapedModel(true);

            model.setUserID(getUserID());
            model.setUserName(HtmlUtil.escape(getUserName()));
            model.setUserEmail(HtmlUtil.escape(getUserEmail()));

            model = (hook_user) Proxy.newProxyInstance(hook_user.class.getClassLoader(),
                    new Class[] { hook_user.class },
                    new ReadOnlyBeanHandler(model));

            return model;
        }
    }

    public ExpandoBridge getExpandoBridge() {
        if (_expandoBridge == null) {
            _expandoBridge = new ExpandoBridgeImpl(hook_user.class.getName(),
                    getPrimaryKey());
        }

        return _expandoBridge;
    }

    public Object clone() {
        hook_userImpl clone = new hook_userImpl();

        clone.setUserID(getUserID());
        clone.setUserName(getUserName());
        clone.setUserEmail(getUserEmail());

        return clone;
    }

    public int compareTo(hook_user hook_user) {
        long pk = hook_user.getPrimaryKey();

        if (getPrimaryKey() < pk) {
            return -1;
        } else if (getPrimaryKey() > pk) {
            return 1;
        } else {
            return 0;
        }
    }

    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }

        hook_user hook_user = null;

        try {
            hook_user = (hook_user) obj;
        } catch (ClassCastException cce) {
            return false;
        }

        long pk = hook_user.getPrimaryKey();

        if (getPrimaryKey() == pk) {
            return true;
        } else {
            return false;
        }
    }

    public int hashCode() {
        return (int) getPrimaryKey();
    }

    public String toString() {
        StringBuilder sb = new StringBuilder();

        sb.append("{userID=");
        sb.append(getUserID());
        sb.append(", userName=");
        sb.append(getUserName());
        sb.append(", userEmail=");
        sb.append(getUserEmail());
        sb.append("}");

        return sb.toString();
    }

    public String toXmlString() {
        StringBuilder sb = new StringBuilder();

        sb.append("<model><model-name>");
        sb.append("edu.hcmiu.portal.model.hook_user");
        sb.append("</model-name>");

        sb.append(
            "<column><column-name>userID</column-name><column-value><![CDATA[");
        sb.append(getUserID());
        sb.append("]]></column-value></column>");
        sb.append(
            "<column><column-name>userName</column-name><column-value><![CDATA[");
        sb.append(getUserName());
        sb.append("]]></column-value></column>");
        sb.append(
            "<column><column-name>userEmail</column-name><column-value><![CDATA[");
        sb.append(getUserEmail());
        sb.append("]]></column-value></column>");

        sb.append("</model>");

        return sb.toString();
    }
}
